<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>简介</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="book.dbase.html">« dBase</a></li>
      <li style="float: right;"><a href="dbase.setup.html">安装/配置 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.dbase.html">dBase</a></li>
    <li>简介</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="intro.dbase" class="preface">
  <h1 class="title">简介</h1>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    此扩展已被移至
<a href="https://pecl.php.net/" class="link external">&raquo;&nbsp;PECL</a> 资源库且不再与 PHP 捆绑。5.3.0.
   </p>
  </p></blockquote>
  <p class="para">
   These functions allow you to access records stored in dBase-format
   (dbf) databases.
  </p>
  <div class="warning"><strong class="warning">警告</strong>
   <p class="para">
    We recommend against using dBase files as your production
    database. Use <a href="http://sqlite.org/" class="link external">&raquo;&nbsp;SQLite</a> or choose any real SQL server instead; <a href="http://www.mysql.com/" class="link external">&raquo;&nbsp;MySQL</a> or <a href="http://www.postgresql.org/" class="link external">&raquo;&nbsp;Postgres</a>
    are common choices with PHP. dBase support is here to allow you to
    import and export data to and from your web database, because the
    file format is commonly understood by Windows spreadsheets and
    organizers.
   </p>
  </div>
  <div class="caution"><strong class="caution">警告</strong>
   <p class="para">
    As of dbase 7.0.0 the databases are automatically locked via
    <span class="function"><a href="function.flock.html" class="function">flock()</a></span>. There has been no support for locking earlier,
    so two concurrent web server processes modifying the same dBase file would
    have very likely ruined your database. This can happen even with dbase
    7.0.0+ on systems which implement the locks at the process level with
    multithreaded SAPIs.
   </p>
  </div>
  <p class="para">
   dBase files are simple sequential files of fixed length records. 
   Records are appended to the end of the file and deleted records are
   kept until you call <span class="function"><a href="function.dbase-pack.html" class="function">dbase_pack()</a></span>.
  </p>
  <p class="para">
   Only dbf file levels 3 (dBASE III+) - 5 (dBASE V) are supported.
   The types of dBase fields available are:
   <table class="doctable table">
    <caption><strong>Available types of fields</strong></caption>
    
     <thead>
      <tr>
       <th>Field</th>
       <th>dBase Type</th>
       <th>Format</th>
       <th>Additional information</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><code class="literal">M</code></td>
       <td>Memo</td>
       <td>n/a</td>
       <td>This type is not supported by PHP, such field will be ignored</td>
      </tr>

      <tr>
       <td><code class="literal">D</code></td>
       <td>Date</td>
       <td><code class="literal">YYYYMMDD</code></td>
       <td>The field length is limited to 8</td>
      </tr>

      <tr>
       <td><code class="literal">T</code></td>
       <td>DateTime</td>
       <td><code class="literal">YYYYMMDDhhmmss.uuu</code></td>
       <td>(FoxPro) No validity checks are done. Available as of dbase 7.0.0.</td>
      </tr>

      <tr>
       <td><code class="literal">N</code></td>
       <td>Number</td>
       <td>A number</td>
       <td>
        You must declare a length and a precision (the number of digits
        after the decimal point).
       </td>
      </tr>

      <tr>
       <td><code class="literal">F</code></td>
       <td>Float</td>
       <td>A float number</td>
       <td>Same as <code class="literal">N</code>.</td>
      </tr>

      <tr>
       <td><code class="literal">C</code></td>
       <td>String</td>
       <td>A string</td>
       <td>You must declare a length. When retrieving data, the string
       will be right-padded with spaces to fit the declared length. Overlong
       strings will be silently truncated when storing data.</td>
      </tr>

      <tr>
       <td><code class="literal">L</code></td>
       <td>Boolean</td>
       <td>
        <code class="literal">T</code> or <code class="literal">Y</code> for <strong><code>true</code></strong>, 
        <code class="literal">F</code> or <code class="literal">N</code> for <strong><code>false</code></strong>,
        <code class="literal">?</code> for uninitialized.
       </td>
       <td>
        As of dbase 7.0.0, returned as a <span class="type">bool</span> (<strong><code>true</code></strong> or <strong><code>false</code></strong>),
        or <strong><code>null</code></strong> for uninitialized fields.
        Formerly, returned as an <span class="type">int</span> (<code class="literal">1</code> or <code class="literal">0</code>).
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    As of dbase 7.0.0 nullable fields are supported for
    <strong><code>DBASE_TYPE_FOXPRO</code></strong> databases. If a field is nullable,
    passing <strong><code>null</code></strong> will set the respective flag, and on later retrieval the field
    value will be <strong><code>null</code></strong>.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    There is no support for indexes or memo fields.
   </p>
  </p></blockquote>
 </div></div></div></body></html>